@extends('layouts.app')
@include('crowd.sidebar')
@section('content')
    <div class="content">
        <div class="row custom-invoice">
            <form method="get" class="form form-inline" action="{{ route('admin.crowd.index') }}">
                <div class="form-group">
                    <input style="min-width: 250px;max-width: 300px" class="form-control" type="text" name="name" value="{{ $name }}" placeholder="用户昵称">
                </div>
                <div class="form-group">
                    <input style="min-width: 250px;max-width: 300px" class="form-control" type="text" name="goods" value="{{ $goods }}" placeholder="礼包名">
                </div>
                <div class="form-group">
                    <button class="btn btn-success btn-ms" type="submit">搜索</button>
                </div>
            </form>
            <br />
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>用户名称</th>
                    <th>用户头像</th>
                    <th>礼包名称</th>
                    <th>众筹金额</th>
                    <th>他人支持</th>
                    <th>自己支持</th>
                    <th>众筹人次</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $item)
                    <tr>
                        <td>{{ $item->nickname }}</td>
                        <td>
                            <img src="{{ $item->avatar }}" width="30" />
                        </td>
                        <td>{{ $item->title }}</td>
                        <td>{{ $item->price/100 }}</td>
                        <td>{{ $item->support_money/100}}</td>
                        <td>{{ $item->self_pay/100  }}</td>
                        <td>{{ $support->get($item->id) }}</td>
                        <td>{{ \App\Modules\Crowd\Models\Crowd::$showStatus[$item->status] }}</td>
                        <td>
                            @if($item->status != \App\Modules\Crowd\Models\Crowd::STATUS_REFUND)
                                <a class="btn btn-primary btn-xs delete-confirm" data-href="{{ route('admin.crowd.refund', ['id' => $item->id]) }}"><i class="fa fa-exchange"></i> 全部退款</a>
                            @endif
                            <a class="btn btn-primary btn-xs" href="{{ route('admin.crowd.support', ['id' => $item->id]) }}"><i class="fa fa-align-justify"></i> 支持列表</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
            {{ $data->appends(['name' => $name, 'goods' => $goods])->links() }}
        </div>
    </div>
@endsection
